﻿using School;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using Moq;

[TestClass()]
public class MoqTest
{
    Student vanko = new Student("Ivan", 22222);
    internal virtual IAddExamResult CreateExamResult()
    {
        var mock = new Mock<IAddExamResult>();
        mock.Setup(x => x.AddResult(vanko, "OOP", 5)).Throws(new ArgumentException());
        mock.Setup(x => x.GetExamResults(vanko)).Throws(new ArgumentNullException());
        return mock.Object;
    }

    [TestMethod()]
    [ExpectedException(typeof(ArgumentException))]
    public void AddExamResultTest()
    {
        IAddExamResult examResult = CreateExamResult();
        string exam = "OOP";
        int grade = 5;
        examResult.AddResult(vanko, exam, grade);
    }

    [TestMethod()]
    [ExpectedException(typeof(ArgumentNullException))]
    public void MainTest()
    {
        IAddExamResult examResult = CreateExamResult();
        examResult.GetExamResults(vanko);
    }
}
